<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./js/jquery.min.js"></script>
</head>
<body>
<div id="div">dd</div>

<script type="text/javascript">
    $(function () {
        $.ajax({
            url: "/trainExam/rest/departments",
            type: "get",
            dataType: "json",
            data: "value=1",//把text传到服务器
            success: function (data) {
                if (data !== undefined) {//检测返回的值是否为空
                    if (data.success) {
                        if (data.data !== undefined) {
                            var html = '<ul>';
                            $.each(data.data, function () {
                                html += "<li>" + this.name + "</li>"
                            });
                            html += "</url>";
                            $("div").html(html);
                        }
                    }
                    else {
                        alert(data.message);
                    }
                }
            }
        });
    });
</script>
</body>
</html>